package com.shrcl.engineerprocess.domain.impl;

import com.shrcl.engineerprocess.domain.TSCManCostCalc;
import com.shrcl.engineerprocess.domain.TSCManCostCalcItem;
import com.shrcl.engineerprocess.domain.TSCWorkLoadType;
import com.shrcl.engineerprocess.domain.impl.TSCManCostCalcImpl;
import com.shrcl.engineerprocess.domain.impl.TSCWorkLoadTypeImpl;
import com.shrcl.engineerprocess.domain.proxy.TSCManCostCalcItemProxy;
import edu.fudan.mylang.pf.BaseModelObject;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.hibernate.annotations.DiscriminatorOptions;

@Entity
@DiscriminatorValue("TSCMANCOSTCALCITEM_TYPE")
@DiscriminatorOptions(force = true)
@DiscriminatorColumn(length = 64)
@Table(name = "tscmancostcalcitem")
public class TSCManCostCalcItemImpl extends BaseModelObject implements TSCManCostCalcItem {
  public TSCManCostCalcItemImpl() {
    super();
  }
  
  public TSCManCostCalcItemImpl(final TSCManCostCalc manCostCalc) {
    super();
    this.manCostCalc = manCostCalc;
  }
  
  @JoinColumn(name = "manCostCalc_id")
  @ManyToOne(targetEntity = TSCManCostCalcImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private TSCManCostCalc manCostCalc;
  
  public TSCManCostCalc getManCostCalc() {
    return this.manCostCalc;
  }
  
  public TSCManCostCalcItem setManCostCalc(final TSCManCostCalc manCostCalc) {
    this.manCostCalc = manCostCalc;
    return this;			
    
  }
  
  @JoinColumn(name = "workLoadType_id")
  @ManyToOne(targetEntity = TSCWorkLoadTypeImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private TSCWorkLoadType workLoadType;
  
  public TSCWorkLoadType getWorkLoadType() {
    return this.workLoadType;
  }
  
  public TSCManCostCalcItem setWorkLoadType(final TSCWorkLoadType workLoadType) {
    this.workLoadType = workLoadType;
    return this;			
    
  }
  
  private Integer manNumber = Integer.valueOf(0);
  
  public Integer getManNumber() {
    return this.manNumber;
  }
  
  public TSCManCostCalcItem setManNumber(final Integer manNumber) {
    this.manNumber = manNumber;
    return this;			
    
  }
  
  private Integer days = Integer.valueOf(0);
  
  public Integer getDays() {
    return this.days;
  }
  
  public TSCManCostCalcItem setDays(final Integer days) {
    this.days = days;
    return this;			
    
  }
  
  private Integer years = Integer.valueOf(1);
  
  public Integer getYears() {
    return this.years;
  }
  
  public TSCManCostCalcItem setYears(final Integer years) {
    this.years = years;
    return this;			
    
  }
  
  public static TSCManCostCalcItem create(final TSCManCostCalc manCostCalc, final IObjectFactory objectFactory) {
    com.shrcl.engineerprocess.domain.TSCManCostCalcItem tSCManCostCalcItem = new com.shrcl.engineerprocess.domain.impl.TSCManCostCalcItemImpl(
    	manCostCalc
    );
    objectFactory.create(tSCManCostCalcItem);
    return tSCManCostCalcItem;			
    
  }
  
  public static TSCManCostCalcItem createTSCManCostCalcItemImpl(final TSCManCostCalc manCostCalc, final IObjectFactory objectFactory, final Procedure1<TSCManCostCalcItem> init) {
    com.shrcl.engineerprocess.domain.TSCManCostCalcItem tSCManCostCalcItem = new com.shrcl.engineerprocess.domain.impl.TSCManCostCalcItemImpl(
    	manCostCalc
    );
    objectFactory.create(tSCManCostCalcItem);
    init.apply(tSCManCostCalcItem);
    
    return tSCManCostCalcItem;			
    
  }
  
  public TSCManCostCalcItemProxy toProxy() {
    com.shrcl.engineerprocess.domain.proxy.TSCManCostCalcItemProxy proxy = new com.shrcl.engineerprocess.domain.proxy.TSCManCostCalcItemProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
